#include <func.h>

int main(int argc,char **argv)
{
    struct hostent *p;
    p=gethostbyname(argv[1]);
    if(NULL==p)
    {
        printf("getname failed\n");
    }
    printf("name=%s\n",p->h_name);
    int i;
    for(i=0;p->h_aliases[i]!=NULL;i++)
    {
        printf("bieming=%s\n",p->h_aliases[i]);
    }
    printf("%d\n",p->h_addrtype);
    printf("%d\n",p->h_length);
    char dst[128];
    for(i=0;p->h_addr_list[i]!=NULL;i++)
    {
        bzero(dst,sizeof(dst));
        inet_ntop(p->h_addrtype,p->h_addr_list[i],dst,sizeof(dst));//将网络字节序转换为主机字节序
        puts(dst);
    }
    return 0;
}